package Class20240812;

import java.sql.*;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {

        try {

            Scanner scanner = new Scanner(System.in);
            String ename = scanner.next();
            Class.forName("com.mysql.cj.jdbc.Driver");
            Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/a65?serverTimezone=UTC", "root", "415253");
            Statement statement = connection.createStatement();
            String sql = "delete from emp where ename = ?";

            PreparedStatement preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1, ename);
            int result = preparedStatement.executeUpdate();
            System.out.println(result);
            preparedStatement.close();
            connection.close();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
